﻿using System.Data.Entity;
using Benecura.Data.Model;

namespace Benecura.Data.Repository.Context
{
    public class MasterContext : DbContext
    {
        /// <summary>
        /// With custom connection string
        /// </summary>
        public MasterContext() : base("connectionMASTER") { }

        #region Tables
        public DbSet<Service> Service { get; set; }
        public DbSet<Event> Event { get; set; }
        #endregion

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Service>().Map(m =>
            {
                m.MapInheritedProperties();
                m.ToTable("Service");
            });

            modelBuilder.Entity<Event>().Map(m =>
            {
                m.MapInheritedProperties();
                m.ToTable("Event");
            });
        }
    }
}
